/*
XCommander Extension
http://www.xcommander.ch/
*/

function XCommanderLib() {
	this.messaging = {};
	this.messaging.server = new XCommanderMessageServer();
	this.storage = new XCommanderStorage();
	this.xhr = new XCommanderXHR();
	this.browser = XCommanderBrowser.createBrowser();
}

XCommanderLib.prototype = {
	_eventListener : new XCommanderEventListener(),
	init : function() {
		return this._eventListener.fireEvent({
			'type' : 'ready'
		});
	},
	getExtensionScheme : function() {
		return 'xcommander://';
	},
	addEventListener : function(type, callback) {
		return this._eventListener.addEventListener(type, callback);
	},
	removeEventListener : function(type, callback) {
		return this._eventListener.removeEventListener(type, callback);
	},
};

var xcommander = {};
xcommander.lib = new XCommanderLib();

function XCommanderNotImplementedException(method) {
	this.prototype = Error.prototype;
	this.name = 'XCommanderNotImplementedException';
	this.message = 'Method ' + (method ? method + ' ' : '') + 'is not implemented';
	this.toString = function() {
		return this.name + ': ' + this.message;
	};
}